package com.suredy.app.porject.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.suredy.core.model.BaseModel;
import com.suredy.security.entity.UserEntity;

/**
 * 合同收款计划
 * 
 * @author VIVID.G
 * @since 2015-12-14
 * @version v0.1
 */
@Entity
@Table(name = "tb_contract_payin_plan")
public class ContractPayinPlan extends BaseModel {

	private static final long serialVersionUID = 1L;

	/* 计划变更 */
	@Column(name = "changed", columnDefinition = "int default 0")
	private Boolean changed;

	/* 变更原因 */
	@Column(name = "change_reason", columnDefinition = "text")
	private String changeReason;

	/* 收款事项 */
	@Column(name = "reason", nullable = false, length = 1000)
	private String reason;

	/* 资金数量 */
	@Column(nullable = false, columnDefinition = "double(255,2) default 0.00")
	private Double total;

	/* 收款日期 */
	@Column(name = "back_time", nullable = false)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date backTime;

	/* 关联的招标信息 */
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "contract_id")
	private Contract contract;

	/* 创建日期 */
	@Column(name = "create_time", nullable = false)
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date createTime;

	/* 是否已收回 */
	@Column(nullable = false, columnDefinition = "int default 0")
	private Boolean back;

	/* 创建人 */
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "creater_id")
	private UserEntity creater;

	/* 收款负责人 */
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "header_id")
	private UserEntity header;

	/* 收款单位 */
	@Column(name = "money_from", length = 500)
	private String moneyFrom;

	/* 备注 */
	@Column(name = "remark", length = 3000)
	private String remark;

	public Boolean getChanged() {
		return changed;
	}

	public void setChanged(Boolean changed) {
		this.changed = changed;
	}

	public String getChangeReason() {
		return changeReason;
	}

	public void setChangeReason(String changeReason) {
		this.changeReason = changeReason;
	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	public Double getTotal() {
		return total;
	}

	public void setTotal(Double total) {
		this.total = total;
	}

	public Date getBackTime() {
		return backTime;
	}

	public void setBackTime(Date backTime) {
		this.backTime = backTime;
	}

	public Contract getContract() {
		return contract;
	}

	public void setContract(Contract contract) {
		this.contract = contract;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Boolean getBack() {
		return back;
	}

	public void setBack(Boolean back) {
		this.back = back;
	}

	public UserEntity getCreater() {
		return creater;
	}

	public void setCreater(UserEntity creater) {
		this.creater = creater;
	}

	public UserEntity getHeader() {
		return header;
	}

	public void setHeader(UserEntity header) {
		this.header = header;
	}

	public String getMoneyFrom() {
		return moneyFrom;
	}

	public void setMoneyFrom(String moneyFrom) {
		this.moneyFrom = moneyFrom;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
